*********************************************************************************
/*  Create Scatter of Tax Burden	*/
*********************************************************************************

* File paths
local datapath "${mvpf_audits}/data/cleaned" 
local datafolder "${mvpf_audits}/data/jamie/data" 
local graphpath "${graphpath}" 

* Version of fig to produce 
global version  ${version} // paper or slides

* Other formatting
if "${version}" == "slides" {
	global title "title(" ", size(vhuge))"
	global img wmf
	graph set window fontface "Arial"
	global title "title(" ", size(vhuge))"
	global axis_size "" //xsize(6.5) ysize(4)" // makes figure wider
}

else if "${version}" == "paper" {
	global title "title("")"
	global img pdf
	graph set window fontface "LMRoman10-Regular"
	global title " "
	global axis_size " " // makes figure wider
}

local outcomes = "mean_total_burden_p mean_burden_hours_p mean_money_burden_p"

*************************************************************
*Graphing Hours, Money Spent, and Total Burden by TPI Bin
*************************************************************
preserve
use "${mvpf_audits}/data/figures_rep/ap16.dta", clear

foreach var in `outcomes' {
	if "`var'" == "mean_money_burden_p" {
		local ytit = "Spending"
		local yscales = ""
	}
		
	if "`var'" == "mean_burden_hours_p" {
		local ytit = "Hours Spent"
		local yscales = "yscale(r(0 40)) ylabel(0(10)40)"
	}
	
	if "`var'" == "mean_total_burden_p" {
		local ytit = "Total Burden"
		local yscales = ""
	}
	
	tw  (scatter `var' decile, mc(dknavy) msymbol(T) msize(medlarge)) ///
		, ///
		ylab(, nogrid) ///
		ytitle("`ytit'") xtitle("TPI Decile") `yscales' ///
		${title} ${axis_size} ///
		xlabel(10(10)110 , valuelabel  nogrid) xscale(r(10 115))  ///
		legend(off)
	graph export "`graphpath'/scatter_`ytit'.wmf", as(wmf) replace
}
restore

*************************************************************
*Graphing Burden by TPI Bin Split by Change and No Change
*************************************************************
preserve
use "${mvpf_audits}/data/figures_rep/ap18.dta", clear

foreach var in `outcomes' {
	if "`var'" == "mean_money_burden_p" {
		local ytit = "Spending"
		local yscales = ""
	}
		
	if "`var'" == "mean_burden_hours_p" {
		local ytit = "Hours Spent"
		local yscales = "yscale(r(0 40)) ylabel(0(10)40)"
	}
	
	if "`var'" == "mean_total_burden_p" {
		local ytit = "Total Burden"
		local yscales = ""
	}
	
	tw  (scatter `var' decile if assessed0 == 1, mc("115 175 235") msymbol(T) msize(med)) ///
		(scatter `var' decile if assessed0 == 0, mc(dknavy) msymbol(O) msize(med)) ///
		, ///
		ylab(, nogrid) ///
		ytitle("`ytit'") xtitle("TPI Decile") `yscales' ///
		${title} ${axis_size} ///
		xlabel(10(10)110 , valuelabel  nogrid) xscale(r(10 115))  ///
		legend(order(1 2 )  lab(1 "No Change") lab(2 "Change") ///
		ring(0) pos(11) col(1) symxsize(*3.5) region(lcolor(gs11)))
	graph export "`graphpath'/scatter_`ytit'_changesplit.wmf", as(wmf) replace
}
restore